package org.sith.taskrunner.gwt.client.presenter;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.HasWidgets;
import org.sith.taskrunner.gwt.client.event.GuiActionEvent;
import org.sith.taskrunner.gwt.client.view.IAdminButtonsView;


public class AdminButtonsPresenter implements Presenter,IAdminButtonsView.Presenter{


    private IAdminButtonsView view;
    private EventBus eventBus;
    private HasWidgets container;

    public AdminButtonsPresenter(IAdminButtonsView view, EventBus eventBus){
        this.view = view;
        this.eventBus = eventBus;
    }


    @Override
    public void go(HasWidgets container) {
        //To change body of implemented methods use File | Settings | File Templates.
        this.container = container;
        container.add(view.getViewWidget());
    }

    @Override
    public void showUsersTable() {
        GuiActionEvent event = new GuiActionEvent();
        event.setEventType(GuiActionEvent.EventType.SHOW_USERS);
        eventBus.fireEvent(event);
    }
}
